#define _CRT_SECURE_NO_WARNINGS 

#include	<stdio.h>
#include	<stdlib.h>
#include	<assert.h>


void arrayCombine(int* arr1, int len1, int* arr2, int len2)
{
	int end1 = len1 - 1;
	int end2 = len2 - 1;
	int end3 = end1 + end2+1;
	while (end2>=0)
	{

		if ((end1 >=0 )&&(arr1[end1] >= arr2[end2]))
		{
			arr1[end3] = arr1[end1];
			end1--; end3--;
		}
		else
		{
			arr1[end3] = arr2[end2];
			end2--; end3--;
		}
	}
}



int main()
{
	int arr1[50] = { 4,5,7,9,10,23,99 };
	int arr2[] = { 0,1,2,3,4,6,8,9 } ;
	int len1 = 7;
	int len2 = 7;

	arrayCombine(arr1, len1, arr2, len2);


	for (int i = 0;i < 50;i++)
		printf("%d ", arr1[i]);
	return 0;
}